﻿// <com.woyouqiu.Copyright>
// --------------------------------------------------------------
// <copyright>上海有求网络科技有限公司 2015</copyright>
// <Solution>BangChuang</Solution>
// <Project>BangChuang.Core</Project>
// <FileName>ProductCategory.cs</FileName>
// <CreateTime>2017-04-16 21:07</CreateTime>
// <Author>何苗</Author>
// <Email>hemiao@woyouqiu.com</Email>
// <log date="2017-04-16 21:07" version="00001">创建</log>
// --------------------------------------------------------------
// </com.woyouqiu.Copyright>

using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Abp.Domain.Entities.Auditing;

namespace Vecen.BangChuang.BangChuang.Products {
    [Table("ProductCategories")]
    public class ProductCategory: FullAuditedEntity {

        /// <summary>
        /// 商品类别
        /// <seealso cref="Products.ProductType"/>
        /// </summary>
        public string ProductType { get; set; }
        public int? ParentId { get; set; }

        [ForeignKey("ParentId")]
        public ProductCategory ParentCategory { get; set; }

        [StringLength(128)]
        public string Name { get; set; }
        
        [StringLength(128)]
        public string FullCode => ParentCategory == null ? Id.ToString() : ParentCategory.FullCode + "-" + Id;
    }
}